<!--
 * @Author: Bobby
 * @Date: 2021-12-30 10:01:42
 * @LastEditTime: 2022-02-15 17:59:41
 * @LastEditors: Bobby
 * @Description:
 * @FilePath: \wms-v2\src\ve\elements\other\uiTimeline\uiTimeline.vue
 * CIMC-V2
-->
<template>
  <el-timeline v-if="info.data.requestData.data.length > 0" class="overflow-scroll">
    <el-timeline-item
      v-for="(activity, index) in info.data.requestData.data"
      :key="index"
      :hide-timestamp="activity.hideTimestamp"
      :placement="activity.placement"
      :size="activity.size"
      :timestamp="activity.timestamp"
      :type="activity.type"
    >
      {{ activity.content }}
    </el-timeline-item>
  </el-timeline>
  <el-empty :description="translateTitle('Ve.elements.暂无数据')" />
</template>
<script>
  import { translateTitle } from '@/utils/i18n'
  import { defineComponent } from 'vue'
  import { UiMixin } from '@ve/mixin'
  export default defineComponent({
    name: 'UiTimeline',
    components: {},
    mixins: [UiMixin],
    data() {
      return {
        list: [],
      }
    },
    computed: {
      getData() {
        return this.info.data.requestData.data
      },
    },
    watch: {
      getData: {
        immediate: true,
        handler: function (newval) {
          this.getDataList(newval)
        },
      },
    },
    mounted() {
      this.getDataList(this.getData)
    },
    methods: {
      translateTitle,
      getDataList(list) {
        list.forEach((row) => {
          row.hideTimestamp = this.info.extension.hideTimestamp.value
          row.placement = this.info.extension.placement.value
          row.size = this.info.extension.size.value
          row.type = this.info.extension.type.value
        })
        this.list = list
      },
    },
  })
</script>
